<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>预算列表</title>
	<meta name="decorator" content="default"/>
	<style type="text/css">
		.tb1th{
			padding-left: 60px !important;
			padding-right: 60px !important;
		}
		/*.breadcrumb{*/
		/*background-color: white;*/
		/*}*/
		#tableDiv{
			max-width: 100%;
			overflow-x: scroll;
		}
	</style>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/oa/budget/listBudget">预算列表</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="budget" action="${ctx}/oa/budget/listBudget" method="post" class="breadcrumb form-search">
		<label>项目名称：&nbsp;</label>
		<form:input path="title" htmlEscape="false" maxlength="50" class="input-medium" placeholder="请输入项目名称"/>
		<label>预算年度：&nbsp;</label>
		<input id="annual" name="annual" type="text" readonly="readonly" maxlength="20" class="required input-medium Wdate"
			   value="${budget.annual}" onclick="WdatePicker({dateFmt:'yyyy',isShowClear:true});"/>
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<label>处室：&nbsp;</label>
		<sys:treeselect id="office" name="office.id" value="${office.id}" labelName="office.name" labelValue="${budget.office.name}"
						title="处室" url="/sys/office/treeData?type=2" cssClass="required recipient" cssStyle="width:150px"
						allowClear="true" notAllowSelectParent="true" smallBtn="false"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
	</form:form>
	<sys:message content="${message}"/>
	<div id="tableDiv">
		<table id="contentTable" class="table table-striped table-bordered table-condensed">
			<thead><tr>
				<th class="tb1th">项目名称</th>
				<th class="tb1th">当前环节</th>
				<th>预算年度</th>
				<th class="tb1th">处室</th>
				<th class="tb1th">项目分类</th>
				<th class="tb1th">所属项目</th>
				<th>总计（万元）</th>
				<c:forEach items="${page.list[0].subjectList}" var="budget" step="1" varStatus="status">
					<th >
							[${budget.code}]${budget.name}
					</th>
				</c:forEach>
				<th>&nbsp;&nbsp;&nbsp;申请时间&nbsp;&nbsp;&nbsp;</th><shiro:hasPermission name="oa:budget:edit"><th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;操作&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th></shiro:hasPermission></tr></thead>
			<tbody>
			<c:forEach items="${page.list}" var="budget">
				<tr>
					<td><a href="${ctx}/oa/budget/form?id=${budget.id}">${budget.title}</a></td>
					<td>
						<c:choose>
							<c:when test="${not empty budget.currentAct.histIns.activityName}">
								${budget.currentAct.histIns.activityName}
							</c:when>
							<c:otherwise>
								未提交审核
							</c:otherwise>
						</c:choose>
					</td>
					<td>${budget.annual}</td>
					<td>${budget.office.name}</td>
					<td>${budget.classify.name}</td>
					<td>${budget.category.name}</td>
					<td>
						<fmt:formatNumber type="number" maxFractionDigits="4" value="${budget.aggregate}"></fmt:formatNumber>
					</td>
					<c:forEach items="${budget.subjectList}"  step="1" varStatus="status">
						<td >
							<fmt:formatNumber type="number" maxFractionDigits="4" value="${budget.subjectList[status.index].money}"></fmt:formatNumber>
						</td>
					</c:forEach>
					<td><fmt:formatDate value="${budget.createDate}" type="both" pattern="yy-MM-dd"/></td>
					<shiro:hasPermission name="oa:budget:edit">
						<td>
							<a href="${ctx}/oa/budget/form?id=${budget.id}">详情</a>
							<a href="${ctx}/oa/budget/history?id=${budget.id}">历史记录</a>

						<%--<a href="${ctx}/oa/budget/delete?id=${budget.id}" onclick="return confirmx('确认要删除该审批吗？', this.href)">删除</a>--%>
						</td>
					</shiro:hasPermission>
				</tr>
			</c:forEach>
			<c:if test="${not empty budgetSum}">
			<tr><td>总计</td><td colspan="56"><fmt:formatNumber type="number" maxFractionDigits="4" value="${budgetSum}"></fmt:formatNumber>
				万元</td></tr>
			</c:if>
			</tbody>
		</table>
	</div>
	<div class="pagination">${page}</div>
</body>
</html>
